package com.drunkoid.db;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class UserDB implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -6837154932296323006L;
	private Calendar cal;
	
	@PrimaryKey
	private String key;

	@Persistent
	private double longitude;

	@Persistent
	private double latitude;
	
	@Persistent
	private Date date;
	
	@Persistent
	private long lastOkTime;

	public UserDB(String id, double longitude, double latitude) {
		this.latitude=latitude;
		this.longitude = longitude;
		this.key = id;
		this.lastOkTime = System.currentTimeMillis();
		cal = Calendar.getInstance();
		setDate();
	}

	public String getKey() {
		return key;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public Date getDate() {
		return date;
	}

	public void setDate() {
		this.date = cal.getTime();
	}

	public long getLastOkTime() {
		return lastOkTime;
	}

	public void setLastOkTime() {
		this.lastOkTime = System.currentTimeMillis();
	}
}
